package com.example.datacollection.controller;

import com.baomidou.mybatisplus.core.metadata.IPage;
import com.example.datacollection.bean.SysUser;
import com.example.datacollection.bean.TableTest;
import com.example.datacollection.config.ResultMap;
import com.example.datacollection.service.TableService;
import lombok.extern.slf4j.Slf4j;

import org.apache.catalina.security.SecurityUtil;
import org.apache.shiro.SecurityUtils;
import org.apache.shiro.authc.AuthenticationException;
import org.apache.shiro.authc.IncorrectCredentialsException;
import org.apache.shiro.authc.UnknownAccountException;
import org.apache.shiro.authc.UsernamePasswordToken;
import org.apache.shiro.subject.Subject;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.*;

import java.util.*;

@RestController
@RequestMapping("table")
@Slf4j
public class TableController {
    @Autowired
    private TableService tableService;

    @RequestMapping("/tableTest")
    public Map<String, Object> tableTest(@RequestParam Map<String, Object> map) {
        log.info(map.toString());
        IPage<TableTest> iPage = tableService.getTbleList(map);
        return ResultMap.ok("list", iPage);
    }

    @RequestMapping("/saveTest")
    public Map<String, Object> saveTest(TableTest tableTest) {
        log.info(tableTest.toString());
        Map<String, Object> map = tableService.saveTable(tableTest);
        log.info(map.toString());
        return map;
    }

}
